package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.JtTraceabilityReportMapper;
import com.ruoyi.business.domain.JtTraceabilityReport;
import com.ruoyi.business.service.IJtTraceabilityReportService;
import com.ruoyi.common.core.text.Convert;

/**
 * 产品报告Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2025-05-22
 */
@Service
public class JtTraceabilityReportServiceImpl implements IJtTraceabilityReportService 
{
    @Autowired
    private JtTraceabilityReportMapper jtTraceabilityReportMapper;

    /**
     * 查询产品报告
     * 
     * @param reportId 产品报告主键
     * @return 产品报告
     */
    @Override
    public JtTraceabilityReport selectJtTraceabilityReportByReportId(Long reportId)
    {
        return jtTraceabilityReportMapper.selectJtTraceabilityReportByReportId(reportId);
    }

    /**
     * 查询产品报告列表
     * 
     * @param jtTraceabilityReport 产品报告
     * @return 产品报告
     */
    @Override
    public List<JtTraceabilityReport> selectJtTraceabilityReportList(JtTraceabilityReport jtTraceabilityReport)
    {
        return jtTraceabilityReportMapper.selectJtTraceabilityReportList(jtTraceabilityReport);
    }

    /**
     * 新增产品报告
     * 
     * @param jtTraceabilityReport 产品报告
     * @return 结果
     */
    @Override
    public int insertJtTraceabilityReport(JtTraceabilityReport jtTraceabilityReport)
    {
        jtTraceabilityReport.setCreateTime(DateUtils.getNowDate());
        return jtTraceabilityReportMapper.insertJtTraceabilityReport(jtTraceabilityReport);
    }

    /**
     * 修改产品报告
     * 
     * @param jtTraceabilityReport 产品报告
     * @return 结果
     */
    @Override
    public int updateJtTraceabilityReport(JtTraceabilityReport jtTraceabilityReport)
    {
        return jtTraceabilityReportMapper.updateJtTraceabilityReport(jtTraceabilityReport);
    }

    /**
     * 批量删除产品报告
     * 
     * @param reportIds 需要删除的产品报告主键
     * @return 结果
     */
    @Override
    public int deleteJtTraceabilityReportByReportIds(String reportIds)
    {
        return jtTraceabilityReportMapper.deleteJtTraceabilityReportByReportIds(Convert.toStrArray(reportIds));
    }

    /**
     * 删除产品报告信息
     * 
     * @param reportId 产品报告主键
     * @return 结果
     */
    @Override
    public int deleteJtTraceabilityReportByReportId(Long reportId)
    {
        return jtTraceabilityReportMapper.deleteJtTraceabilityReportByReportId(reportId);
    }

    /**
     * 更新排序
     * @param list
     * @return
     */
    @Override
    public int bathUpdateSaveSort(List<JtTraceabilityReport> list){
        return jtTraceabilityReportMapper.bathUpdateSaveSort(list);
    }

    /**
     * 根据溯源id 查询报告
     * @param traceabilityId
     * @return
     */
    @Override
    public List<JtTraceabilityReport> selectJtTraceabilityReportById(Long traceabilityId){
        return jtTraceabilityReportMapper.selectJtTraceabilityReportById(traceabilityId);
    }
}
